import request from '@/utils/request'

// 查询养修信息预约列表
export function listAppointment(query) {
  return request({
    url: '/business/appointment/list',
    method: 'get',
    params: query
  })
}

// 查询养修信息预约详细
export function getAppointment(id) {
  return request({
    url: '/business/appointment/' + id,
    method: 'get'
  })
}

// 新增养修信息预约
export function addAppointment(data) {
  return request({
    url: '/business/appointment',
    method: 'post',
    data: data
  })
}

// 修改养修信息预约
export function updateAppointment(data) {
  return request({
    url: '/business/appointment',
    method: 'put',
    data: data
  })
}

// 删除养修信息预约
export function delAppointment(id) {
  return request({
    url: '/business/appointment/' + id,
    method: 'delete'
  })
}

// 到店功能  arrival
export function arrival(id) {
  return request({
    url: '/business/appointment/' + id,
    method: 'patch',
    headers:{"cmd":'arrival'}
  })
}

// 取消功能 cancelOp
export function cancelOp(id) {
  return request({
    url: '/business/appointment/' + id,
    method: 'patch',
    headers:{"cmd":'cancel'}
  })
}

// 生成或查找结算单
export function createOrSelectStatement(id) {
  return request({
    //   预约单/1/对应什么资源（结算单）  /business/appointment/1/statement
    url: '/business/appointment/' + id + "/statement",
    method: 'post',
  })
}